<?php

// app/Http/Middleware/LanguageMiddleware.php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class LanguageMiddleware
{
    public function handle($request, Closure $next)
    {
        // 获取用户的语言偏好（例如从请求参数或用户信息中获取）
        $locale = $request->cookie('locale', config('app.locale'));
        app()->setLocale($locale);

        return $next($request);
    }
}
